<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/9/21
 * Time: 19:35
 */

    header('Content-type:text/html;charset=utf-8');?>
<?php
    const DISCOUNT = 0.95;
    $fruit1 = '草莓';
    $fruit2 = '西瓜';
    $fruit3 = '榴莲';
    $fruit1_num = 10;
    $fruit2_num = 6;
    $fruit3_num = 2;
    $fruit1_price = 20;
    $fruit2_price = 2.22;
    $fruit3_price = 25;
    $fruit1_total = $fruit1_num*$fruit1_price;
    $fruit2_total = $fruit2_num*$fruit2_price;
    $fruit3_total = $fruit3_num*$fruit3_price;
    $total = ($fruit1_total + $fruit2_total + $fruit3_total)*DISCOUNT; 
    $str = "<table>";
    $str .="<tr><td>商品名称</td><td>购买数量（斤）</td><td>商品价格（元）</td></tr>";
    $str .="<tr><td>$fruit1</td><td>$fruit1_num</td><td>$fruit1_price</td></tr>";
    $str .="<tr><td>$fruit2</td><td>$fruit2_num</td><td>$fruit2_price</td></tr>";
    $str .="<tr><td>$fruit3</td><td>$fruit3_num</td><td>$fruit3_price</td></tr>";
    $str .="<tr><td colspan='3'>商品折扣：<span>".DISCOUNT."</span></td></tr>";             
    $str .="<tr><td colspan='3'>打折后购买商品总价格：{$total}元</td></tr>";      
    $str .="</table>";
    echo $str;
?>